<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org" lang="zh-CN">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge"/>
    <meta name="viewport" content="width=device-width, initial-scale=1"/>
    <title>框架原型</title>
    <!-- 常规css -->
    <link th:href="@{bootstrap/css/bootstrap.min.css}" rel="stylesheet" />
    <link th:href="@{font-awesome/css/font-awesome.min.css}" rel="stylesheet" />
    <!-- 项目css -->
    <link th:href="@{css/layout.css}" rel="stylesheet" />
</head>
<body>
    <!-- 侧边导航栏 -->
    <div class="sideNav" th:fragment="sideNavigation">
        <div>
            <h4 style="margin-left: 33px; margin-top:10px"> <i style="color: white">谦家生活 ·</i> <i style="color: #999">后台管理</i></h4>
        </div>
        <ul class="nav nav-pills nav-stacked">
            <li class="first-list" id="main">
                <a th:href="@{main}" role="tab">
                    <i class="fa fa-home fa-fw" aria-hidden="true"></i>&nbsp;&nbsp;首页
                </a>
            </li>
            <li class="first-list">
                <a class="show-menu" href="#">
                    <i class="fa fa-shopping-bag fa-fw" aria-hidden="true"></i>&nbsp;&nbsp;商品管理
                </a>
                <ul class="sub-menu" style="display: none">
                    <li id="goodsNormal" class="second-list"><a th:href="@{goodsNormal}">- 普通商品</a></li>
                    <li id="goodsTicket" class="second-list"><a th:href="@{goodsTicket}">- 卡券商品</a></li>
                    <li id="goodsPoint" class="second-list"><a th:href="@{goodsPoint}">- 积分商品</a></li>
                    <li id="goodsDown" class="second-list"><a th:href="@{goodsDown}">- 已下架商品</a></li>
                </ul>
            </li>
            <li class="first-list" id="orders">
                <a th:href="@{orders}" role="tab">
                    <i class="fa fa-wpforms fa-fw" aria-hidden="true"></i>&nbsp;&nbsp;订单管理
                </a>
            </li>
            <li class="first-list" id="user">
                <a th:href="@{user}" role="tab">
                    <i class="fa fa-users fa-fw" aria-hidden="true"></i>&nbsp;&nbsp;用户管理
                </a>
            </li>
            <li class="first-list" id="shop">
                <a th:href="@{shop}" role="tab">
                    <i class="fa fa-handshake-o fa-fw" aria-hidden="true"></i>&nbsp;&nbsp;商家管理
                </a>
            </li>
            <li class="first-list">
                <a class="show-menu" href="#">
                    <i class="fa fa-flag fa-fw" aria-hidden="true"></i>&nbsp;&nbsp;活动管理
                </a>
                <ul class="sub-menu" style="display: none">
                    <li id="nowActivity" class="second-list"><a th:href="@{nowActivity}">- 当前活动</a></li>
                    <li id="goodsActivity" class="second-list"><a th:href="@{goodsActivity}">- 设置商品活动</a></li>
                    <li id="auctionList" class="second-list"><a th:href="@{auctionList}">- 拍卖记录</a></li>
                    <li id="seckillList" class="second-list"><a th:href="@{seckillList}">- 秒杀记录</a></li>
                </ul>
            </li>
            <li class="first-list">
                <a class="show-menu" href="#">
                    <i class="fa fa-credit-card fa-fw" aria-hidden="true"></i>&nbsp;&nbsp;优惠券管理
                </a>
                <ul class="sub-menu" style="display: none">
                    <li id="tem" class="second-list"><a th:href="@{tem}">- 优惠券设置</a></li>
                    <li id="coupon" class="second-list"><a th:href="@{coupon}">- 发放历史</a></li>
                </ul>
            </li>
            <li class="first-list">
                <a class="show-menu" href="#">
                    <i class="fa fa-truck fa-fw" aria-hidden="true"></i>&nbsp;&nbsp;待发货管理
                </a>
                <ul class="sub-menu" style="display: none">
                    <li id="express" class="second-list"><a th:href="@{express}">- 待发货订单</a></li>
                    <li id="pointOrders" class="second-list"><a th:href="@{pointOrders}">- 积分中奖待发货</a></li>
                </ul>
            </li>
            <li class="first-list">
                <a class="show-menu" href="#">
                    <i class="fa fa-check-square-o fa-fw" aria-hidden="true"></i>&nbsp;&nbsp;申请管理
                </a>
                <ul class="sub-menu" style="display: none">
                    <li id="cashout" class="second-list"><a th:href="@{cashout}">- 提现申请</a></li>
                    <li id="refund" class="second-list"><a th:href="@{refund}">- 退款申请</a></li>
                    <li id="contact" class="second-list"><a th:href="@{contact}">- 加盟申请</a></li>
                </ul>
            </li>
            <li class="first-list">
                <a class="show-menu" href="#">
                    <i class="fa fa-wechat fa-fw" aria-hidden="true"></i>&nbsp;&nbsp;客服消息
                </a>
                <ul class="sub-menu" style="display: none">
                    <li id="chatUnread" class="second-list"><a th:href="@{chatUnread}">- 未读消息</a></li>
                    <li id="chatAll" class="second-list"><a th:href="@{chatAll}">- 全部对话</a></li>
                </ul>
            </li>
            <li class="first-list">
                <a class="show-menu" href="#">
                    <i class="fa fa-camera-retro fa-fw" aria-hidden="true"></i>&nbsp;&nbsp;动态管理
                </a>
                <ul class="sub-menu" style="display: none">
<!--                    <li id="checkMoment" class="second-list"><a th:href="@{checkMoment}">- 待审核动态</a></li>-->
                    <li id="moment" class="second-list"><a th:href="@{moment}">- 动态列表</a></li>
                </ul>
            </li>
            <li class="first-list" id="billboard">
                <a th:href="@{billboard}" role="tab">
                    <i class="fa fa-map-o fa-fw" aria-hidden="true"></i>&nbsp;&nbsp;广告管理
                </a>
            </li>
            <li class="first-list">
                <a class="show-menu" href="#">
                    <i class="fa fa-pencil fa-fw" aria-hidden="true"></i>&nbsp;&nbsp;文本编辑
                </a>
                <ul class="sub-menu" style="display: none">
                    <li id="rulePoint" class="second-list"><a th:href="@{rulePoint}">- 积分规则</a></li>
                    <li id="ruleRebate" class="second-list"><a th:href="@{ruleRebate}">- 返利规则</a></li>
                    <li id="ruleVip" class="second-list"><a th:href="@{ruleVip}">- 会员规则</a></li>
                    <li id="aboutUs" class="second-list"><a th:href="@{aboutUs}">- 关于我们</a></li>
                </ul>
            </li>
            <li class="first-list">
                <a class="show-menu" href="#">
                    <i class="fa fa-coffee fa-fw" aria-hidden="true"></i>&nbsp;&nbsp;阳台设计
                </a>
                <ul class="sub-menu" style="display: none">
                    <li id="appoint" class="second-list"><a th:href="@{appoint}">- 设计预约</a></li>
                    <li id="designer" class="second-list"><a th:href="@{designer}">- 设计师信息</a></li>
                    <li id="measure" class="second-list"><a th:href="@{measure}">- 上门量房预约</a></li>
                </ul>
            </li>
            <li class="first-list" id="admin">
                <a th:href="@{admin}" role="tab">
                    <i class="fa fa-cogs fa-fw" aria-hidden="true"></i>&nbsp;&nbsp;管理员设置
                </a>
            </li>

        </ul>
    </div>

    <!-- 主界面 -->
    <div class="content" style="padding:0">
        <!-- 顶部导航栏 -->
        <div th:fragment="topNavigation">
            <nav class="navbar navbar-default">
                <div class="container-fluid">
                    <div class="navbar-header">

                    </div>

                    <ul class="nav navbar-nav">
                        <a class="navbar-brand" th:href="@{main}">&nbsp;<span class="glyphicon glyphicon-home"></span>&nbsp;</a>
                    </ul>
                    <ul class="nav navbar-nav navbar-right">
                        <li class="dropdown">
                            <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">
                                <span class="fa fa-bell-o">&nbsp;提醒</span> <span class="badge" id="num-total"></span> <span class="caret"></span>
                            </a>
                            <ul class="dropdown-menu">
                                <li><a th:href="@{express}">待发货订单&nbsp;<span class="badge" id="num-fahuo"></span></a></li>
                                <li><a th:href="@{pointOrders}">积分中奖待发货&nbsp;<span class="badge" id="num-zhongjiang"></span></a></li>
                                <li role="separator" class="divider"></li>
                                <li><a th:href="@{cashout}">提现申请&nbsp;<span class="badge" id="num-tixian"></span></a></li>
                                <li><a th:href="@{refund}">退款申请&nbsp;<span class="badge" id="num-tuikuan"></span></a></li>
                                <li role="separator" class="divider"></li>
                                <li><a th:href="@{appoint}">设计师预约&nbsp;<span class="badge" id="num-yuyue"></span></a></li>
                                <li><a th:href="@{measure}">上门量房预约&nbsp;<span class="badge" id="num-liangfang"></span></a></li>
                                <li><a th:href="@{contact}">加盟申请&nbsp;<span class="badge" id="num-jiameng"></span></a></li>
                                <li role="separator" class="divider"></li>
                                <li><a th:href="@{chatUnread}">客服消息&nbsp;<span class="badge" id="num-kefu"></span></a></li>
                            </ul>
                        </li>
                        <li class="dropdown">
                            <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">
                                <img th:src="@{images/admin.jpg}" alt="admin" style="max-height: 18px; margin-right:4px" />
                                <span th:text="${session.adminName}"></span>
                                <span class="caret"></span>
                            </a>
                            <ul class="dropdown-menu">
                                <li><a href="#" data-toggle="modal" data-target="#setModal"><i class="fa fa-cog"></i>&nbsp;&nbsp;修改密码</a></li>
                                <li role="separator" class="divider"></li>
                                <li><a href="logout"><i class="fa fa-sign-out"></i>&nbsp;&nbsp;退出</a></li>
                            </ul>
                        </li>
                    </ul>
                </div>
            </nav>
        </div>

        <!--    ##页面核心内容##    -->

        <!-- 分页组件 -->
        <nav aria-label="Page navigation" th:fragment="pagingBar">
            <ul class="pagination">
                <!-- 上一页 -->
                <li>
                    <a th:href="@{${#httpServletRequest.requestURL}(sort=${asort},order=${aorder},pageIndex=${data.pageIndex}-1,num=${data.num},totalPages=${data.totalPages})}" aria-label="Previous" th:if="${1 ne data.pageIndex}">
                        <span aria-hidden="true">上一页</span>
                    </a>
                    <a href="#" th:if="${1 eq data.pageIndex}" style="color: #888888;pointer-events: none;">
                        <span aria-hidden="true">上一页</span>
                    </a>
                </li>
                <!-- 中间页 -->
                <li th:if="${data.totalPages>0}" th:each="pageIdx:${#numbers.sequence(1, data.totalPages)}">
                    <a th:href="@{${#httpServletRequest.requestURL}(sort=${asort},order=${aorder},pageIndex=${pageIdx},num=${data.num},totalPages=${data.totalPages})}" th:text="${pageIdx}" th:if="${pageIdx ne data.pageIndex}"></a>
                    <a href="#" th:text="${pageIdx}" th:if="${pageIdx eq data.pageIndex}" th:style="'font-weight:bold;background: #6faed9;pointer-events: none;'"></a>
                </li>
                <li th:if="${data.totalPages==0}">
                    <a href="#" th:text="${1}" th:style="'font-weight:bold;background: #6faed9;pointer-events: none;'"></a>
                </li>
                <!-- 下一页 -->
                <li th:if="${data.totalPages>0}">
                    <a th:href="@{${#httpServletRequest.requestURL}(sort=${asort},order=${aorder},pageIndex=${data.pageIndex}+1,num=${data.num},totalPages=${data.totalPages})}" aria-label="Next" th:if="${data.totalPages ne data.pageIndex}">
                        <span aria-hidden="true">下一页</span>
                    </a>
                    <a href="#" th:if="${data.totalPages eq data.pageIndex}" style="color: #888888;pointer-events: none;">
                        <span aria-hidden="true">下一页</span>
                    </a>
                </li>
                <li th:if="${data.totalPages==0}">
                    <a href="#" style="color: #888888;pointer-events: none;">
                        <span aria-hidden="true">下一页</span>
                    </a>
                </li>
            </ul>
        </nav>


        <!--    ##页面核心内容##    -->

    </div>

    <!-- 模态框: 修改密码 -->
    <form class="form-horizontal" role="form" id="setForm" style="margin: 20px;" th:fragment="modifyPwd">
        <div class="modal fade" id="setModal" tabindex="-1" role="dialog" aria-labelledby="setModalLabel" aria-hidden="true">
            <div class="modal-dialog">
                <div class="modal-content">
                    <div class="modal-header">
                        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
                        <h4 class="modal-title" id="setModalLabel"> 修改密码 </h4>
                    </div>
                    <div class="modal-body">
                        <div class="form-group">
                            <label for="input_pwd" class="col-sm-3 control-label">原密码</label>
                            <div class="col-sm-7">
                                <input type="password" class="form-control" id="input_pwd" placeholder="请输入原密码">
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="npwd" class="col-sm-3 control-label">新密码</label>
                            <div class="col-sm-7">
                                <input type="password" class="form-control" name="npwd" id="npwd" placeholder="请输入新密码">
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="cpwd" class="col-sm-3 control-label">确认新密码</label>
                            <div class="col-sm-7">
                                <input type="password" class="form-control" name="cpwd" id="cpwd" placeholder="请再次输入新密码">
                            </div>
                        </div>
                        <input type='hidden' name='opwd' id='opwd' value=''/>
                    </div>
                    <div class="modal-footer">
                        <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
                        <button type="button" class="btn btn-primary" id="setButton">确认</button>
                    </div>
                </div>
            </div>
        </div>
    </form>

<!-- 常规js -->
<script th:src="@{js/jquery-3.4.1.min.js}"></script>
<script th:src="@{bootstrap/js/bootstrap.min.js}"></script>
<!-- 模板js -->
<script type="text/javascript" th:fragment="js-highlight">
    $(document).ready(function () {
        var location = window.location.href;
        var id = location.substring(location.lastIndexOf('/')+1);
        var indexOf = location.indexOf('?');
        if(indexOf>0){
            id = location.substring(location.lastIndexOf('/')+1, indexOf);
        }

        if($("#"+id).attr("class")==("first-list")){
            $("#"+id).addClass("active");
        }else if($("#"+id).attr("class")==("second-list")) {
            $("#"+id).addClass("active");
            $("#"+id).parent().prev().css({"cssText": "background-color: #384b5d !important; color: #6fb !important"});
            $("#"+id).parent().css('display', 'block');
        }
    })

    $(function () {
        $(".show-menu").click(function(){
            var show = $(this).next().css("display");
            if ( show == 'block')
            {
                $(this).next().css('display','none');
            }
            if ( show == 'none')
            {
                $(this).next().css('display','block');
            }
        });
    })

    //初始化消息提醒模块
    $(function () {
        $.ajax({
            url : "reminder",
            async : true,
            type : "GET",
            dataType : "json",
            success : function(res) {
                $("#num-total").text(res.total==0?null:res.total);
                $("#num-fahuo").text(res.fahuo==0?null:res.fahuo);
                $("#num-zhongjiang").text(res.zhongjiang==0?null:res.zhongjiang);
                $("#num-tixian").text(res.tixian==0?null:res.tixian);
                $("#num-tuikuan").text(res.tuikuan==0?null:res.tuikuan);
                $("#num-yuyue").text(res.yuyue==0?null:res.yuyue);
                $("#num-liangfang").text(res.liangfang==0?null:res.liangfang);
                $("#num-jiameng").text(res.jiameng==0?null:res.jiameng);
                $("#num-kefu").text(res.kefu==0?null:res.kefu);
            },
            error : function(res) {
            }
        });
    })

</script>

</body>
</html>